﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminCP/admincp.Master" AutoEventWireup="true"
    CodeBehind="ListProduct.aspx.cs" Inherits="VINETLIFE.AdminCP.ListProduct" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <h2>
        Danh sách sản phẩm</h2>
    <div style="float: right; width: 100%;">
        <span style="float: left">Chọn danh mục
            <asp:DropDownList runat="server" ID="ddlParentCate" AppendDataBoundItems="true" AutoPostBack="true"
                OnSelectedIndexChanged="ddlParentCate_SelectedIndexChanged">
                <asp:ListItem Text=".: Danh mục cao nhất :." Value="0"></asp:ListItem>
            </asp:DropDownList>
        </span>
    </div>
    <div class="div-property">
        <asp:GridView ID="grvProduct" DataKeyNames="ProductID" runat="server" AutoGenerateColumns="False"
            CssClass="tstyle2" PageSize="35" AllowPaging="true" Width="100%" PagerStyle-CssClass="pgr"
            OnSelectedIndexChanged="grvProduct_SelectedIndexChanged" OnPageIndexChanging="grvProduct_PageIndexChanging"
            OnRowDeleting="grvProduct_RowDeleting">
            <Columns>
                <asp:TemplateField HeaderText="Số TT" Visible="true" ItemStyle-Width="5%">
                    <ItemTemplate>
                        <%# Container.DataItemIndex + 1 %> 
                    </ItemTemplate>
                </asp:TemplateField>
                
                <asp:TemplateField HeaderText="ProductID" Visible="false" ItemStyle-Width="5%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblProductID" Text='<%#Eval("ProductID") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Mã sản phẩm" ItemStyle-Width="5%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblProductCode" Text='<%#Eval("ProductCode") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tên sản phẩm" ItemStyle-Width="14%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblProductTitle" Text='<%#Eval("ProductTitle") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Danh mục sản phẩm" ItemStyle-Width="15%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblProductCategoryTitle" Text='<%#Eval("ProductCategoryTitle") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <%--<asp:TemplateField HeaderText="Thuộc tính" ItemStyle-Width="15%">
                    <ItemTemplate>
                        <asp:Repeater runat="server" ID="rptProductProperties" DataSource='<%#ProductPropertiesDataSource(int.Parse(DataBinder.Eval(Container.DataItem,"ProductID").ToString())) %>'>
                            <ItemTemplate>
                            <div class="properties-wrap">
                                <asp:Label runat="server" ID="lblPropertyName" Text='<%#Eval("PropertyName") %>'></asp:Label>:
                                <asp:Label runat="server" ID="lblValue" Text='<%#Eval("Value") %>' CssClass="bold"></asp:Label>
                                </div>
                            </ItemTemplate>
                        </asp:Repeater>
                    </ItemTemplate>
                </asp:TemplateField>--%>
                <asp:TemplateField HeaderText="Hình ảnh" ItemStyle-Width="9%">
                    <ItemTemplate>
                       <img width="100px" height="70px" src="<%#"/Media/" + (Eval("ProductImage")).ToString() %>" title="<%#Eval("ProductTitle")%>" />
                    </ItemTemplate>
                    
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Tình trạng hàng" ItemStyle-Width="9%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblOrderID" Text='<%#((Boolean)Eval("Active"))==true?"Còn hàng": "Hết hàng" %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Bảo hành" ItemStyle-Width="7%">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblWarranty" Text='<%#Eval("Warranty") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField ItemStyle-Width="5%" HeaderText="Thao tác" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:ImageButton ID="btnEdit" runat="server" CommandName="Select" ImageUrl="~/AdminCP/images/edit_16x16.gif" />
                        <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%#Eval("ProductID") %>'
                            CommandName="Delete" ImageUrl="~/AdminCP/images/delete_16x16.gif" OnClientClick="return confirm('Có muốn xóa bản ghi này? Nhấn OK để xóa!')" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <p style="float:left; margin-top:10px;">
            <a href="Product.aspx" class="button-gg-green">Thêm sản phẩm </a>
        </p>
    </div>
</asp:Content>
